package com.knowledgegraph.web.controller.zhongyao;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.knowledgegraph.common.annotation.Log;
import com.knowledgegraph.common.core.controller.BaseController;
import com.knowledgegraph.common.core.domain.AjaxResult;
import com.knowledgegraph.common.enums.BusinessType;
import com.knowledgegraph.zhongyao.domain.Docker;
import com.knowledgegraph.zhongyao.service.IDockerService;
import com.knowledgegraph.common.utils.poi.ExcelUtil;
import com.knowledgegraph.common.core.page.TableDataInfo;

/**
 * 医师维护Controller
 * 
 * @author ruoyi
 * @date 2023-07-04
 */
@RestController
@RequestMapping("/zhongyao/docker")
public class DockerController extends BaseController
{
    @Autowired
    private IDockerService dockerService;

    /**
     * 查询医师维护列表
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:list')")
    @GetMapping("/list")
    public TableDataInfo list(Docker docker)
    {
        startPage();
        List<Docker> list = dockerService.selectDockerList(docker);
        return getDataTable(list);
    }

    /**
     * 导出医师维护列表
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:export')")
    @Log(title = "医师维护", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Docker docker)
    {
        List<Docker> list = dockerService.selectDockerList(docker);
        ExcelUtil<Docker> util = new ExcelUtil<Docker>(Docker.class);
        util.exportExcel(response, list, "医师维护数据");
    }

    /**
     * 获取医师维护详细信息
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:query')")
    @GetMapping(value = "/{docKey}")
    public AjaxResult getInfo(@PathVariable("docKey") String docKey)
    {
        return AjaxResult.success(dockerService.selectDockerByDocKey(docKey));
    }

    /**
     * 新增医师维护
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:add')")
    @Log(title = "医师维护", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Docker docker)
    {
        return toAjax(dockerService.insertDocker(docker));
    }

    /**
     * 修改医师维护
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:edit')")
    @Log(title = "医师维护", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Docker docker)
    {
        return toAjax(dockerService.updateDocker(docker));
    }

    /**
     * 删除医师维护
     */
    @PreAuthorize("@ss.hasPermi('zhongyao:docker:remove')")
    @Log(title = "医师维护", businessType = BusinessType.DELETE)
	@DeleteMapping("/{docKeys}")
    public AjaxResult remove(@PathVariable String[] docKeys)
    {
        return toAjax(dockerService.deleteDockerByDocKeys(docKeys));
    }
}
